Ext.onReady(function(){

    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';

    pageform = new Ext.FormPanel({
        labelWidth: 75, // label settings here cascade unless overridden
        standardSubmit: true,
		fileUpload: true,
		url: '/admin/',
        frame:true,
        title: document.getElementById('pageTitle').value,
        bodyStyle:'padding:5px 5px 0',
        width: 600,

        items: [{
                name: 'text',
                xtype: 'ckeditor',
                hideLabel: true,
                CKConfig: {
                    /* Enter your CKEditor config paramaters here or define a custom CKEditor config file. */
                    customConfig : '/public/assets/ckeditor/config.js',
                    toolbar: 'Str',
                    height : 400,
                    width: 570
                },
				value: document.getElementById('pageTxt').value
		}],

        buttons: [{
            text: 'Сохранить',
			handler: function(b) {
				var fp = this.ownerCt.ownerCt,
					form = fp.getForm();
				if (form.isValid()) {
					b.disable();
					form.getEl().dom.action = '/admin/page/update/' + document.getElementById('pageAlias').value;
					form.submit();
            	} else {
					formhotelcreate.form.markInvalid();
					Ext.MessageBox.alert('Ошибка!', 'Ошибка, информация неверная! Проверьте правильность заполнения полей!');
				}
			}
        }]
    });

    pageform.render(Ext.get('pagediv'));
});
